﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PDX
{
    /// <summary>
    /// Generates <see cref="Declaration"/>s using reflection
    /// </summary>
    public class ReflectionDeclarer : IDeclarationBuilder
    {
        /// <summary>
        /// Builds the declarations.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <returns></returns>
        public IEnumerable<Declaration> BuildDeclarations(object target)
        {
            var props = target.GetType().GetProperties();

            foreach (var prop in props)
            {
                var dec = new Declaration();
                dec.Path = prop.Name;
                yield return dec;
            }
        }
    }
}
